<h3>Market info</h3>

<%= form_for @market,
    as:  :trading_pair,
    url: @market.new_record? ? admin_markets_url : admin_market_url(@market.id) do |f| %>

  <div class="card-deck">

    <div class="card">
      <div class="card-body">
        <div class="form-group">
          <label>Bid unit</label>
          <% if @market.new_record? %>
            <%= f.select :bid_unit, Currency.codes.map { |code| [code.upcase, code] }, {}, { class: "form-control mb-3" } %>
          <% else %>
            <div class="mb-3"><%= @market.bid_unit.upcase %></div>
          <% end %>

          <label>Bid fee</label>
          <%= f.text_field :bid_fee, class: 'form-control mb-3' %>

          <label>Bid precision</label>
          <% if @market.new_record? %>
            <%= f.number_field :bid_precision, class: 'form-control mb-3' %>
          <% else %>
            <div><%= @market.bid_precision %></div>
          <% end %>
        </div>
      </div>
    </div>

    <div class="card">
      <div class="card-body">
        <div class="form-group">
          <label>Ask unit</label>
          <% if @market.new_record? %>
            <%= f.select :ask_unit, Currency.codes.map { |code| [code.upcase, code] }, {}, { class: "form-control mb-3" } %>
          <% else %>
            <div class="mb-3"><%= @market.ask_unit.upcase %></div>
          <% end %>
          <label>Ask fee</label>
          <%= f.text_field :ask_fee, class: 'form-control mb-3' %>
          <label>Ask precision</label>
          <% if @market.new_record? %>
            <%= f.number_field :ask_precision, class: 'form-control' %>
          <% else %>
            <div><%= @market.ask_precision %></div>
          <% end %>
        </div>
      </div>
    </div>

    <div class="card">
      <div class="card-body">
        <div class="form-group form-check">
          <%= f.check_box :enabled, class: 'form-check-input' %>
          <label class="form-check-label" for="trading_pair_enabled">Enabled</label>
        </div>
        <div class="form-group">
          <label>Position</label>
          <%= f.number_field :position, class: 'form-control' %>
        </div>
      </div>
    </div>

  </div>

  <%= f.submit 'Submit', class: 'btn btn-primary btn-lg mt-3' %>

<% end %>
